﻿using System;
using System.Collections.Generic;
using System.Text;

namespace SharpHomeEngine
{

    //public class StateChangeRequestsAsync : StateChangeRequests<StateChangeRequestAsync>
    //{
    //    private static Int64 AsyncHandle = 0;
    //    public readonly Int64 Handle = 0;

    //    public StateChangeRequestsAsync() : base()
    //    {
    //        lock (this)
    //        {
    //            Handle = ++AsyncHandle;
    //        }
    //    }

    //    public override void PerformStateChanges()
    //    {
    //            //StateEngine.StateChangeComplete += new StateChangeCompleteHandler(StateEngine_StateChangeComplete);
                
    //    }

    //    int Completed = 0;
    //    void StateEngine_StateChangeComplete(long Handle, DeviceInterface DeviceInterface, Device Device, Tag Tag, object Value)
    //    {
    //        foreach (StateChangeRequestSync Request in this)
    //        {
    //            if (Request.Handle == Handle)
    //            {
    //                lock (this)
    //                {
    //                    Completed++;
    //                }
    //            }
    //        }
    //        int Comp = 0;
    //        int Count = 0;
    //        lock (this)
    //        {
    //            Comp = Completed;
    //            Count = this.Count;
    //        }

    //        if (Comp == Count)
    //        {
    //            StateEngine.Engine.NotifyOfStateChangesAsyncCompleted(this.Handle);
    //        }
    //        //StateEngine.StateChangeComplete -= StateEngine_StateChangeComplete;
    //    }

    //}
}
